#! /bin/bash

[ $# -ne 1 ] && { echo "please enter config_file as a parameter"; exit; } 


#$1 - username
CURRENT_PATH=/home/$1;
#----------BASE-REPOSITORY-CONFIG-----------

#remove local repo
	S_LIST=`cat /etc/apt/sources.list`;
	echo "$S_LIST" | sed -r 's/^deb cdrom/#deb cdrom/g' > /etc/apt/sources.list 

#add from rus repo
	echo "deb http://ftp.ru.debian.org/debian/ stable main contrib" >> /etc/apt/sources.list

#add from rus non-free repo
	echo "deb http://ftp.ru.debian.org/debian/ stable main contrib non-free" >> /etc/apt/sources.list

	apt-get -y update
#--------------------------------------------


#------REMOVING--------
	apt-get -y remove nano vim.tiny;


#-----INSTALING--------

# base needfull things
apt-get -y install mc vim lynx git ctags 

#installing graphical desktop environment
	apt-get -y install xorg awesome awesome-extra feh xcompmgr # transset
	apt-get -y install gtk2-engines-murrine gtk-theme-switch 


#installing terminal
	apt-get -y install lxterminal

#instaling network

	apt-get -y install network-manager-gnome
	apt-get -y install transmisson 
# properitary wireless drivers 
	tar xvf ./drivers/firmware/Broadcom_Firmware.tar.gz -C /lib/firmware/

#installing audio
	apt-get -y install gnome-alsamixer pulseaudio xfce4-volumed xfce4-mixer gstreamer0.10 



#power managment
	 
#install other
	apt-get -y install gitg gpicview virtualbox-ose evince
#install chrome
	dpkg -i ./thirdParty/google-chrome-stable_current_i386.deb
	#apt-get -y  install chromium-browser chromium-browser-l10n flashplugin-nonfree
#install developments tool
	apt-get -y install gcc g++ openjdk-6-jdk vim-gtk
	apt-get -y install  gcl

# install arhivers
	apt-get -y install zip unrar p7zip-full
#-------install database----------------------------
	apt-get -y install sqlite3


#----------COPYING CONFIGURATION FILES FONTS ETC-----
#-----------documents-------------------
	apt-get -y install openoffice.org


#----loginManager--------
	
	sudo apt-get slim
	cp -r ./config/slim/* /usr/share/slim/themes/
	rm /usr/slim.conf
	sudo ln -s $PWD/config/slim/slim.conf  /etc/slim.conf



#------------------------
cp -r ./config/fonts/ /usr/share
ln -s ./config/vim/.vimrc $CURRENT_PATH/.vimrc 
ln -s ./config/vim/ $CURRENT_PATH/.vim/
ln -s ./config/awesome/awesome $CURRENT_PATH/.config/awesome/

#TMP=`cat $CURRENT_PATH/.config/awesome/rc.lua | sed "s/__USER_NAME/$1/g"`
#rm $CURRENT_PATH/.config/awesome/rc.lua; 
#echo "$TMP" > $CURRENT_PATH/.config/awesome/rc.lua; 




#TMP=`cat $CURRENT_PATH/.config/awesome/themes/stoffd/theme.lua | sed "s/__USER_NAME/$1/g"`;
#rm $CURRENT_PATH/.config/awesome/themes/stoffd/theme.lua; 
#echo "$TMP" > $CURRENT_PATH/.config/awesome/themes/stoffd/theme.lua; 

#chown -hR stoffd:stoffd $CURRENT_PATH/.config/
#chown -hR stoffd:stoffd $CURRENT_PATH/.vim/
#chown -hR stoffd:stoffd $CURRENT_PATH/.vimrc/

# vi_mode for bash

echo "set -o vi" > $CURRENT_PATH/.bashrc
